package com.pacific.sign;

import com.pacific.sign.biz.user.service.UserService;
import com.pacific.sign.model.po.oaSchema.view.UserInfo;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;

import javax.servlet.http.HttpServletRequest;

/**
 * Created by whz on 2014/12/2.
 */
public class BaseController {

	protected static final Logger logger = LogManager.getLogger();

	private static final String HTTP_IMAGE_URL="http://192.168.200.211:80/";

	@Autowired
	private UserService userService;

	/**
	 * 登陆人员信息
	 * @param request
	 * @return
	 */
	protected UserInfo getUserInfo(HttpServletRequest request){
		Integer userId = (Integer) request.getSession().getAttribute(WebConstant.CURRENT_LOGIN_USER_INFO);
		return userService.queryUserByOaCode(String.valueOf(userId));
	}

	/**
	 * 获取图片服务器地址
	 * @return
	 */
	protected String getHttpImgUrl(String imgKey){
		return HTTP_IMAGE_URL + imgKey;
	}

}
